<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<link href="/ajax/libs/jquery-layout/jquery.layout-latest.css" th:href="@{/ajax/libs/jquery-layout/jquery.layout-latest.css}" rel="stylesheet"/>
<body class="gray-bg">
	<div class="container-div ui-layout-center">
		<div class="row">
			<div class="col-sm-12 select-info">
				<form id="user-form">
					<div class="select-list">
						<ul>
							<li>
								工作内容：<input type="text" name="workContent"/>
							</li>
							<li>
								审批状态：<select name="status" th:with="type=${@dict.getType('sys_daily_approve')}">
								<option value="">所有</option>
								<option th:each="e : ${type}" th:text="${e['dictLabel']}" th:value="${e['dictValue']}"></option>
							</select>
							</li>
							<li class="select-time">
								<label>工作时间： </label>
								<input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginTime]"/>
								<span>-</span>
								<input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endTime]"/>
							</li>
							<li>
								<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
								<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
							</li>
						</ul>
					</div>
				</form>
			</div>

			<div class="btn-group hidden-xs" id="toolbar" role="group">
				<a class="btn btn-outline btn-success btn-rounded" onclick="$.operate.add()" shiro:hasPermission="module:daily:add">
					<i class="fa fa-plus"></i> 新增
				</a>
				<a class="btn btn-outline btn-danger btn-rounded" onclick="$.operate.removeAll()" shiro:hasPermission="module:daily:remove">
					<i class="fa fa-trash-o"></i> 删除
				</a>
				<a class="btn btn-success btn-outline btn-rounded" onclick="$.table.exportExcel()" shiro:hasPermission="module:daily:export">
					<i class="fa fa-download"></i>&nbsp;导出
				</a>
			</div>

			<div class="col-sm-12 select-info table-striped">
				<table id="bootstrap-table" data-mobile-responsive="true"></table>
			</div>
		</div>
	</div>

    <div th:include="include :: footer"></div>
	<script th:src="@{/ajax/libs/jquery-layout/jquery.layout-latest.js}"></script>
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('module:daily:edit')}]];
        var removeFlag = [[${@permission.hasPermi('module:daily:remove')}]];
        var datas = [[${@dict.getType('sys_daily_approve')}]];
        var prefix = ctx + "module/daily"

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                sortName: "workDate",
                sortOrder: "desc",
                modalName: "日报管理",
                search: false,
                showExport: false,// 是否支持导出文件
                showRefresh:false,// 是否显示刷新按钮
                showColumns :false,// 是否显示隐藏某列下拉框
                showToggle:false,// 是否显示详细视图和列表视图的切换按钮
                // addHeight:720,
                // editHeight:680,
                columns: [{
		            checkbox: true
		        },
				{
					field : 'dailyId', 
					title : '序号',
                    align: 'center',
                    visible: false
				},
				{
					field : 'workContent', 
					title : '工作内容' 
				},
				{
					field : 'workDate', 
					title : '工作时间',
                    align: 'center',
                    sortable: true
				},
				{
					field : 'workHours', 
					title : '工作时长' ,
                    align: 'center'
				},
				{
					field : 'user.userName',
					title : '审批人' ,
					align: 'center'
				},
				{
					field : 'status',
					title : '审批状态' ,
					align: 'center',
					formatter: function(value, item, index) {
						return $.table.selectDictLabel(datas, item.status);
					}
				},
				{
					field : 'opinion',
					title : '审批意见'
				},
		        {
		            title: '操作',
		            align: 'center',
		            formatter: function(value, row, index) {
		            	var actions = [];
		            	actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.dailyId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.dailyId + '\')"><i class="fa fa-remove"></i>删除</a>');
						return actions.join('');
		            }
		        }]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>